package com.commpany.servie.basic.clickhistory.service.write;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import com.commpany.jiedianqian.system.exception.BusinessException;
import com.commpany.jiedianqian.system.exception.SystemErrorEnum;
import com.commpany.servie.basic.clickhistory.api.write.ClickHistoryWriteService;
import com.commpany.servie.basic.clickhistory.converter.ClickHistoryConverter;
import com.commpany.servie.basic.clickhistory.business.write.clickHistory.ClickHistoryWriteManage;
import com.commpany.servie.basic.clickhistory.model.dto.clickhistory.ClickHistoryDTO;
@Slf4j
@Service("clickHistoryWriteService")
public class ClickHistoryWriteServiceImpl  implements ClickHistoryWriteService {
	@Autowired
	private ClickHistoryWriteManage clickHistoryWriteManage;
	
	public int insertClickHistoryService( ClickHistoryDTO inputDTO ){
	   try {
	       return clickHistoryWriteManage.insertClickHistoryService(ClickHistoryConverter.toPO(inputDTO));
	     } catch (Exception e) {
			// TODO Auto-generated catch block
			log.error("系统异常", e);
			throw new BusinessException(SystemErrorEnum.SYSTEM_ERROR.getValue(), SystemErrorEnum.SYSTEM_ERROR.name());
		}
	}
    public int updateClickHistoryService( ClickHistoryDTO inputDTO ){
       try {
           return clickHistoryWriteManage.updateClickHistoryService(ClickHistoryConverter.toPO(inputDTO));
        } catch (Exception e) {
			// TODO Auto-generated catch block
			log.error("系统异常", e);
			throw new BusinessException(SystemErrorEnum.SYSTEM_ERROR.getValue(), SystemErrorEnum.SYSTEM_ERROR.name());
		}
    }
    public int deleteClickHistoryService( ClickHistoryDTO inputDTO ){
      try {
          return clickHistoryWriteManage.deleteClickHistoryService(ClickHistoryConverter.toPO(inputDTO));
      } catch (Exception e) {
			// TODO Auto-generated catch block
			log.error("系统异常", e);
			throw new BusinessException(SystemErrorEnum.SYSTEM_ERROR.getValue(), SystemErrorEnum.SYSTEM_ERROR.name());
		}
    }
}
	